#include "ShortMessage.h"

void OperationObject::sendMessage()
{
//	QNetworkAccessManager* manager = new QNetworkAccessManager;
//	QNetworkRequest request(QUrl("http://sms.api.bz/fetion.php"));

//	connect(manager, SIGNAL(finished(QNetworkReply*)), manager, SLOT(deleteLater()));
//	connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(deleteLater()));
//	connect(manager, SIGNAL(finished(QNetworkReply*)), m_Thread, SLOT(quit()));

//	manager->post(request, m_Data);
//		m_Thread->quit();
//		delete manager;
//		delete this;
}

void SendMessageThread::run()
{
	m_OpObject = new OperationObject(this, m_Data);
	QTimer::singleShot(500, m_OpObject, SLOT(sendMessage()));
	exec();
}


void SendMessageViaFetion(
		const QString &phoneNo,
		const QString &phonePass,
		const QString &desPhoneNo,
		const QString &message)
{
	QString data("username=%1&password=%2&sendto=%3&message=%4");
	data = data.arg(phoneNo, phonePass, desPhoneNo, message);
	SendMessageThread* sendMessageThread = new SendMessageThread(data.toUtf8());
	sendMessageThread->start();
}
